package com.guohui.boot1.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.guohui.boot1.entity.DemoUser;

@Configuration
@ConditionalOnClass(com.guohui.boot1.entity.DemoUser.class)//该注解的参数对应的类必须存在，否则不解析该注解修饰的配置类；
public class DefaultConfigration {

  @Autowired
  DefaultUserProperty defaultUserProperty;
  
  @Bean(name = "defaultUser")
  public DemoUser defaultUser(){
    
    DemoUser user = new DemoUser();
    user.setId(defaultUserProperty.getId());
    user.setName(defaultUserProperty.getName());
    user.setMobile(defaultUserProperty.getMobile());
    
    return user;
    
  }
  
}
